package com.seaside.park.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.service.Contact;

@Configuration
@EnableOpenApi
public class SwaggerConfiguration {
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(info())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.seaside.park.api"))
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo info() {
        return new ApiInfoBuilder()
                .title("自定义Swagger-UI接口文档")
                .description("自定义文档")
                .contact(new Contact("Bear","http://www.yuque.com/bearpessimist","1942496795@qq.com"))
                .version("1.0")
                .license("Apache-2.0")
                .build();
    }
}
